package org.scut.smartgeometry.view.identify_system.shape.inf;

import org.scut.smartgeometry.view.identify_system.SGPath;
import org.scut.smartgeometry.view.identify_system.SGPoint;
import org.scut.smartgeometry.view.identify_system.shape.SGShape;

import java.util.List;

/**
 * Created by Administrator on 13-7-12.
 */
public class SGQuadrangle extends SGShape {


    private List<SGPoint> vertexes;

    public SGQuadrangle(List<SGPoint> points, SGPath path, List<SGPoint> vertexes) {
        super(points, path);
        this.vertexes = vertexes;
    }

    public SGQuadrangle(List<SGPoint> points, SGPath path, SGPoint core, List<SGPoint> vertexes) {
        super(points, path, core);
        this.vertexes = vertexes;
    }


    @Override
    public void draw() {
        super.draw();

        SGPath path = getPath();
        path.reset();

        for(int i = 0 ; i < vertexes.size(); i++){
            SGPoint vertex = vertexes.get(i);
            if(i == 0) path.moveTo(vertex.getX() , vertex.getY());
            else{
                path.lineTo(vertex.getX(), vertex.getY());
            }
        }
        path.close();


    }

}
